package cn.itcast.java.sports;

/**
 * Author itcast
 * Date 2021/10/9 15:12
 * 顶级父类，用于定义共有信息
 */
public abstract class Person {

    //姓名和年龄
    private String name;
    private int age;

    //指定getter setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //吃饭抽象方法
    public abstract void eat();

    @Override
    public String toString() {
        return "姓名="+name+" 年龄="+age;
    }
}
